﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Observer_WeatherMonitor.Data {
    public class CurrentConditionsDisplay : IObserver, IDisplayElement {
        private float temperature;
        private float humidity;
        private float pressure;
        private ISubject weatherData;

        public CurrentConditionsDisplay(ISubject _weatherData) {
            weatherData = _weatherData;
            _weatherData.RegisterObserver(this);
        }

        public void Update(float temperature, float humidity, float pressure) {
            this.temperature = temperature;
            this.humidity = humidity;
            this.pressure = pressure;
            Display();
        }
        public void Display() {
            Console.WriteLine("Current condistions: " + temperature + "F degrees and " + humidity + "% humidity");
        }
    }
}
